Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
interface NodaTime.​Text.​IPattern<​T>
Assembly: NodaTime
Generic interface supporting parsing and formatting. Parsing always results in a <see cref="T:NodaTime.Text.ParseResult`1" /> which can represent success or failure.
Remarks
Idiomatic text handling in Noda Time involves creating a pattern once and reusing it multiple
times, rather than specifying the pattern text repeatedly. All patterns are immutable and thread-safe,
and include the culture used for localization purposes.
Methods
ParseResult<​T>
Parse​(string text)
Parses the given text value according to the rules of this pattern.
Returns The result of parsing, which may be successful or unsuccessful.
text
The text value to parse.
Remarks
This method never throws an exception (barring a bug in Noda Time itself). Even errors such as
the argument being null are wrapped in a parse result.
string
Format​(T value)
Formats the given value as text according to the rules of this pattern.
Returns The value formatted according to this pattern.
value
The value to format.
AppendFormat​(T value,
System.​Text.​StringBuilder builder)
Formats the given value as text according to the rules of this pattern,
appending to the given <see cref="T:System.Text.StringBuilder" /> .
Returns The builder passed in as <paramref name="builder" /> .
value
The value to format.
builder
The <c>StringBuilder</c> to append to.